home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-09-26 | 5.9 KB | 234 lines | [TEXT/CWIE] |
- -- This script requires SiteCam 5.1 or higher
-
- -- Specify start and stop degree settings (reverse for non-inverted use)
- set startDegrees to 100 -- (-100 to 100)
- set stopDegrees to -100 -- (-100 to 100)
-
- -- The number of pictures to use in your panorama
- set numFrames to 6
-
- -- Should a panorama file be generated (requires an existing SiteZAP-Stitch pano document)
- -- You can set this to false if you just want to test the picture taking
- set makePano to true
-
-
- -- The captions to put on the "key frame" . Currently only one caption is used, but you can use more
- -- by adding them in order where the "" are. Before using, set the size, color, style, etc.
- -- in SiteCam's "Pano" document.
- -- We put the caption in using the script because you only want the caption on one image.
- set captionList to {"Created with SiteZAP", "", "", ""}
-
-
- -- The captionFrame is the frame that we put the above captions on.
- -- The captions should be already be set up (position, color, size, etc) in the Pano SiteCam document.
- set captionFrame to 4
-
-
- -- Set to true if you want to keep QTVR Authoring studio open at all times.
- set keepQTVROpen to true
-
-
- -------------------------------------------------------------------------------------
- -- script source code -- Modify at your own risk -- ©1999 Brad Lowe Rearden Technology
- -------------------------------------------------------------------------------------
-
-
- with timeout of 6000 seconds
- -- Get path to store temp picture files
- set the_path to MakeTempDirectory()
-
- set success to my OpenPanoDocument()
-
- if (success) then
- set success to TakePanoPicts(startDegrees, stopDegrees, numFrames, the_path, captionFrame)
-
- -- if all was well, instruct qtvr-as to build a panorama.
-
- if (success and makePano) then my MakeQTVRPanorama()
- end if
-
- try
- tell application "Finder"
- activate
- end tell
- tell application "SiteCam"
- activate
- end tell
- end try
-
- end timeout
-
-
-
- -- This is the key frame that we add text or a logo to.
- on SetCaptions()
- beep
- tell application "SiteCam"
- repeat with x from 1 to 4
- set message of caption x of document "pano" to (item x of captionList)
- end repeat
- end tell
- end SetCaptions
-
- -- This is not the key frame. We delete any text or logos that might exist.
- on UnsetCaptions()
- tell application "SiteCam"
- repeat with x from 1 to 4
- set message of caption x of document "pano" to ""
- end repeat
- end tell
- end UnsetCaptions
-
- -- Attempt to open the SiteCam document "pano".
- on OpenPanoDocument()
- if (my OpenDoc("pano") is false) then
- tell application "SiteCam"
- -- Create document "pano" (a quarter size, medium resolution image)
- make new document
- --set width of active document to 320
- -- set height of active document to 240
- set image type of active document to pict
- save active document as "pano"
- end tell
- end if
- return true
- end OpenPanoDocument
-
-
- on OpenDoc(docName)
- try
- tell application "SiteCam"
- if document docName exists then return true
- open file docName
- end tell
- on error
- return false
- end try
- return true
-
- end OpenDoc
-
-
-
- on TakePanoPicts(startDegrees, stopDegrees, frames, the_path, keyFrame)
- set success to false
- -- turn off access to the SiteZAP by remote users.
-
-
- try
-
- set unitsPerDegree to 8.8
-
- set startDegrees to checkbounds(startDegrees, -100, 100)
- set stopDegrees to checkbounds(stopDegrees, -100, 100)
-
- set panPos to startDegrees * unitsPerDegree
- set panIncrement to ((stopDegrees - startDegrees) * unitsPerDegree) / frames
-
- tell application "SiteCam"
- set sitezap control to false -- this turns off user access to the pan/tilt
- set zoom of active pantilt to 0
- end tell
-
- repeat with index from 1 to frames
- tell application "SiteCam"
- set position of active pantilt to {round (panPos), 0}
- set panPos to panPos + panIncrement
- waitticks 30 -- wait a half second for the camera to focus...
- end tell
-
- try
- if (index = keyFrame) then
- SetCaptions()
- else
- UnsetCaptions()
- end if
- end try
-
- if (index < 10) then
- set indexStr to "0" & index
- else
- set indexStr to index
- end if
-
- set fileName to (the_path & indexStr & ".pict")
- tell application "SiteCam"
- take picture with document "pano" as file fileName type pict
- -- take picture with document "pano" as file filename type pict
- end tell
-
- end repeat
-
- set success to true
- end try
-
- tell application "SiteCam"
- set sitezap control to true -- important... return user control to SiteZAP controls
- end tell
-
- return success
-
- end TakePanoPicts
-
- on MakeQTVRPanorama()
-
- -- open QTVR-Stitching Document
- tell application "Finder"
-
- if (file (name of startup disk & ":QuickTime VR Authoring Studio:SiteZAP-Stitch") exists) then
- open file (name of startup disk & ":QuickTime VR Authoring Studio:SiteZAP-Stitch")
- else
- beep
- end if
- end tell
-
-
- -- Use MenuEvents scripting additon to activate the "Stitch Panorama" menu item.
- tell application "QTVR Authoring Studio 1.0.1"
- -- activate
- with timeout of 6000 scene node
- Make Content document "SiteZAP-Stitch"
- end timeout
-
- if (my keepQTVROpen is false) then
- repeat with attempt from 1 to 10
- if (get (count of windows) < 1) then exit repeat
- close window 1 saving no
- end repeat
- quit saving no
- end if
-
- end tell
-
-
-
-
- end MakeQTVRPanorama
-
-
-
- -- Create a temp directory for qtvr images.
- on MakeTempDirectory()
- tell application "Finder"
- set the_path to name of startup disk & ":qtvr:"
- set hasFolder to folder the_path exists
- if (not hasFolder) then
- set new_folder to make new folder at startup disk
- set name of new_folder to "qtvr"
-
- -- first time setup... user must make new QTVR Pano document.
- set makePano to false
- end if
- end tell
- return the_path
- end MakeTempDirectory
-
- -- Make sure a parameter or value is within specified max/mins.
- on checkbounds(inValue, min, max)
- if (inValue < min) then return min
- if (inValue > max) then return max
- return inValue
- end checkbounds
-
-
-